﻿using System.Collections;
using System.Collections.Generic;
using PMS.IRepository;
using PMS.IServices;
using PMS.Models.Base;
using PMS.Repository;
using PMS.Utils;

namespace PMS.Services
{
    public class BaseConfigService : IBaseConfigService
    {
        IBaseConfigRepository _BaseConfigRepository = new BaseConfigRepository();

        #region 公共方法

        public int Add(BaseConfig user)
        {
            return _BaseConfigRepository.Add(user);
        }

        public int Edit(BaseConfig user)
        {
            return _BaseConfigRepository.Edit(user);
        }

        public BaseConfig Dtl(int id)
        {
            return _BaseConfigRepository.Dtl(id);
        }

        public bool IsExists(int id)
        {
            return _BaseConfigRepository.IsExists(id);
        }

        public int Delete(int id, string deleteBy)
        {
            return _BaseConfigRepository.Delete(id, deleteBy);
        }

        public int Delete(int[] ids, string deleteBy)
        {
            return _BaseConfigRepository.Delete(ids, deleteBy);
        }

        public List<BaseConfig> GetList()
        {
            return _BaseConfigRepository.GetList();
        }

        public List<BaseConfig> GetList(Hashtable ht, string orderFiled, string sort, int pageIndex, int pageSize, out int counts)
        {
            return _BaseConfigRepository.GetList(ht, orderFiled, sort, pageIndex, pageSize, out counts);
        }

        #endregion

        public List<BaseConfig> GetList(Hashtable ht)
        {
            //string strWhere = string.Empty;
            //Dictionary<string, object> param = new Dictionary<string, object>();
            //if (ht.IsNullOrEmptyByKey("RoleName"))
            //{
            //    strWhere += " And RoleName like @RoleName ";
            //    param.Add("@RoleName", ht["RoleName"]);
            //}

            //if (ht.IsNullOrEmptyByKey("IsDel"))
            //{
            //    strWhere += " And IsDel = @IsDel ";
            //    param.Add("@IsDel", ht["IsDel"]);
            //}
            //else
            //{
            //    strWhere += " And IsDel = 0 ";
            //}

            //string strSql = "Select * from BaseConfig where 1=1" + strWhere;

            return _BaseConfigRepository.GetList(ht);

        }
    }
}